function checkAddService() {
    var fm = document.add;
    if(fm.name.value.length < 2) {
    	alert('售后服务名称不能少于两位!');
    	fm.name.focus();
    	return false;
    } 
    if(fm.name.value.length > 20) {
        alert('售后服务名称不能大于二十位!');
        fm.name.focus();
        return false;
    } 
    return true;
}

function ajaxCheckName() {
	var warning = document.getElementById('warning');
	var name = document.add.name;
	warning.style.display = 'none';
	ajax({
		'url':'?a=service&m=ajaxCheckName',
		'method':'post',
		'async':true,
		'data':{
			'name' : name.value
		},
		'success':function(text) {
			if(text == 1) {
				warning.style.display = 'block';
			}
		}
	});
}